package chp13;

import java.util.Scanner;

public class Test9b {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("请输入邮箱地址:");
        String email = input.next();
        //示例
        //输入邮箱 jack@qq.com
        //打印 用户名:jack 域名:qq.com

        int index = email.indexOf("@");
        if(index == -1){
            System.out.println("输入的邮箱格式错误");
            return;
        }
        String username = email.substring(0,index);
        String host = email.substring(index+1);
        System.out.println("用户名:" + username);
        System.out.println("域名:" + host);
    }
}
